package com.woniuxy.microgoodsserver.auctionmag.controller;

import com.github.pagehelper.PageInfo;
import com.slsupermarket.common.res.ResponseMsg;
import com.woniuxy.microgoodsserver.auctionmag.service.GoodsService;
import com.woniuxy.microgoodsserver.bean.*;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/goods")
public class GoodsController {

    @Resource
    GoodsService goodsService;

    @RequestMapping(value = "/goodsfindall",produces = {"application/json;charset=utf-8"})
    public PageInfo<GoodsBean> findAllByParams(PageRequest request,GoodsBean goodsBean){

        PageInfo<GoodsBean> goodsBeans = goodsService.goodsfindAll(request, goodsBean);
            System.out.println(goodsBeans);
            return goodsBeans;

    }

    @RequestMapping(value = "/goodsFindAllById",produces = {"application/json;charset=utf-8"})
    public GoodsBean findAllById(int id){
        System.out.println(id);
        GoodsBean goodsBean = goodsService.goodsfindAllById(id);
        return goodsBean;
    }



}
